/*
 * Copyright 2012-2014 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.jqd.framework.core.hessian.biz.action.support;

/**
 * 
 * TODO
 * 
 * @author liaozhicheng.cn@gmail.com
 * @date 2012-6-11
 * @since 1.0
 */
public class BeanMethodNameActionIdUtils {
	
	private static final String ACTION_ID_REGEX = "(\\w+\\.[a-zA-Z]\\w+)+";
	
	
	private BeanMethodNameActionIdUtils() {
		// 工具类不需要实例化，也不需要子类
	}
	
	
	public static boolean valid(String actionId) {
		return actionId.matches(ACTION_ID_REGEX);
	}
	
	
	public static String getBeanName(String actionId) {
		return actionId.substring(0, actionId.lastIndexOf("."));
	}
	
	
	public static String getMethodName(String actionId) {
		return actionId.substring(actionId.lastIndexOf(".") + 1);
	}
	
	
	public static void main(String[] args) {
		
		String str = "actionBeanName";
		
		System.out.println(getBeanName(str));
	}
	
}
